package ru.evga.inse.core.exception;

abstract public class InfoseaException
    extends Exception
{
    private UnlocaliseMessage m_unlocaliseMessage;

    protected abstract String getPrefix();

    public InfoseaException(String errorId)
    {
        super(errorId);
        m_unlocaliseMessage = UnlocaliseMessage
            .createUnlocaliseMessage(getPrefix() + errorId);
    }

    public InfoseaException(String errorId, Object arg)
    {
        super(errorId);
        m_unlocaliseMessage = UnlocaliseMessage.createUnlocaliseMessage(
            getPrefix() + errorId, arg);
    }

    public InfoseaException(String errorId, Object [] args)
    {
        super(errorId);
        m_unlocaliseMessage = UnlocaliseMessage.createUnlocaliseMessage(
            getPrefix() + errorId, args);
    }

    public UnlocaliseMessage getUnlocaliseMessage()
    {
        return m_unlocaliseMessage;
    }

    @Override
    public String getMessage()
    {
        return m_unlocaliseMessage.getMessageId();
    }
}
